package hr.infomare.drrh.pojo;

// Generated 21.09.2011. 15:44:13 by Hibernate Tools 3.2.1.GA

import hr.infomare.drrh.pomocni.PomocnaDatum;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.StringUtils;

import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.MessageHeader;
import budgetuserlibrary.gw.fmis.ibm.hr.infotypes.NotificationHeader;

/**
 * Dochead generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "DOCHEAD")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Dochead implements java.io.Serializable {

	private int bufmisdoc;

	private String logsysname;
	private String budgetuser;
	private String sapdocid;
	private int docdate;
	private String reference;
	private String currname;
	private String currcode;
	private String currnum;
	private int postdate;
	private String descripthd;
	private String companyco;
	private String docclass;
	private String doccateg;
	private String doctype;
	private String user;
	private int datetime;
	private Long resmsgid;
	private Date datetimews;

	public Dochead() {
	}

	@Id
	@Column(name = "BUFMISDOC", unique = true, nullable = false, precision = 9, scale = 0)
	public int getBufmisdoc() {
		return this.bufmisdoc;
	}

	public void setBufmisdoc(int bufmisdoc) {
		this.bufmisdoc = bufmisdoc;
	}

	@Column(name = "LOGSYSNAME", nullable = false, length = 50)
	public String getLogsysname() {
		return this.logsysname;
	}

	public void setLogsysname(String logsysname) {
		this.logsysname = logsysname;
	}

	@Column(name = "BUDGETUSER", nullable = false, length = 50)
	public String getBudgetuser() {
		return this.budgetuser;
	}

	public void setBudgetuser(String budgetuser) {
		this.budgetuser = budgetuser;
	}

	@Column(name = "SAPDOCID", nullable = false, length = 50)
	public String getSapdocid() {
		return this.sapdocid;
	}

	public void setSapdocid(String sapdocid) {
		this.sapdocid = sapdocid;
	}

	@Column(name = "DOCDATE", nullable = false, precision = 8, scale = 0)
	public int getDocdate() {
		return this.docdate;
	}

	public void setDocdate(int docdate) {
		this.docdate = docdate;
	}

	@Column(name = "REFERENCE", nullable = false, length = 50)
	public String getReference() {
		return this.reference;
	}

	public void setReference(String reference) {
		this.reference = reference;
	}

	@Column(name = "CURRNAME", nullable = false, length = 30)
	public String getCurrname() {
		return this.currname;
	}

	public void setCurrname(String currname) {
		this.currname = currname;
	}

	@Column(name = "CURRCODE", nullable = false, length = 3)
	public String getCurrcode() {
		return this.currcode;
	}

	public void setCurrcode(String currcode) {
		this.currcode = currcode;
	}

	@Column(name = "CURRNUM", nullable = false, length = 3)
	public String getCurrnum() {
		return this.currnum;
	}

	public void setCurrnum(String currnum) {
		this.currnum = currnum;
	}

	@Column(name = "POSTDATE", nullable = false)
	public int getPostdate() {
		return this.postdate;
	}

	public void setPostdate(int postdate) {
		this.postdate = postdate;
	}

	@Column(name = "DESCRIPTHD", nullable = false, length = 120)
	public String getDescripthd() {
		return this.descripthd;
	}

	public void setDescripthd(String descripthd) {
		this.descripthd = descripthd;
	}

	@Column(name = "COMPANYCO", nullable = false, length = 20)
	public String getCompanyco() {
		return this.companyco;
	}

	public void setCompanyco(String companyco) {
		this.companyco = companyco;
	}

	@Column(name = "DOCCLASS", nullable = false, length = 20)
	public String getDocclass() {
		return this.docclass;
	}

	public void setDocclass(String docclass) {
		this.docclass = docclass;
	}

	@Column(name = "DOCCATEG", nullable = false, length = 50)
	public String getDoccateg() {
		return this.doccateg;
	}

	public void setDoccateg(String doccateg) {
		this.doccateg = doccateg;
	}

	@Column(name = "DOCTYPE", nullable = false, length = 120)
	public String getDoctype() {
		return this.doctype;
	}

	public void setDoctype(String doctype) {
		this.doctype = doctype;
	}

	@Column(name = "USER", nullable = false, length = 10)
	public String getUser() {
		return this.user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	@Column(name = "DATETIME", nullable = false, precision = 8, scale = 0)
	public int getDatetime() {
		return this.datetime;
	}

	public void setDatetime(int datetime) {
		this.datetime = datetime;
	}

	@Column(name = "RESMSGID", precision = 9, scale = 0)
	public Long getResmsgid() {
		return this.resmsgid;
	}

	public void setResmsgid(Long resmsgid) {
		this.resmsgid = resmsgid;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "DATETIMEWS", length = 10)
	public Date getDatetimews() {
		return this.datetimews;
	}

	public void setDatetimews(Date datetimews) {
		this.datetimews = datetimews;
	}

	public void postaviVrijednosti(NotificationHeader notificationHeader,
			MessageHeader messageHeader) {
		sapdocid = StringUtils.isBlank(notificationHeader.getSapDocumentId()) ? sapdocid
				: notificationHeader.getSapDocumentId();
		resmsgid = messageHeader.getResponseMsgId();
		datetimews = PomocnaDatum.XMLDatumUDate(messageHeader
				.getSubmitionTimestamp());
	}
}
